home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Programming / nsis-2.46-setup.exe / Contrib / Modern UI 2 / Pages / Components.nsh next >
Encoding:
Text File  |  2008-02-20  |  6.8 KB  |  243 lines

  1. /*
  2.  
  3. NSIS Modern User Interface
  4. Components page
  5.  
  6. */
  7.  
  8. ;--------------------------------
  9. ;Page interface settings and variables
  10.  
  11. !macro MUI_COMPONENTSPAGE_INTERFACE
  12.  
  13.   !ifndef MUI_COMPONENTSPAGE_INTERFACE
  14.     !define MUI_COMPONENTSPAGE_INTERFACE
  15.     Var mui.ComponentsPage
  16.     
  17.     Var mui.ComponentsPage.Text
  18.     Var mui.ComponentsPage.InstTypesText
  19.     Var mui.ComponentsPage.ComponentsText 
  20.  
  21.     Var mui.ComponentsPage.InstTypes
  22.     Var mui.ComponentsPage.Components    
  23.     
  24.     Var mui.ComponentsPage.DescriptionTitle
  25.     Var mui.ComponentsPage.DescriptionText.Info
  26.     Var mui.ComponentsPage.DescriptionText
  27.     
  28.     Var mui.ComponentsPage.SpaceRequired
  29.     
  30.     !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_CHECKBITMAP "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"
  31.     
  32.     !insertmacro MUI_DEFAULT MUI_UI_COMPONENTSPAGE_SMALLDESC "${NSISDIR}\Contrib\UIs\modern_smalldesc.exe"
  33.     !insertmacro MUI_DEFAULT MUI_UI_COMPONENTSPAGE_NODESC "${NSISDIR}\Contrib\UIs\modern_nodesc.exe"
  34.     
  35.     ;Apply settings
  36.     
  37.     !ifdef MUI_COMPONENTSPAGE_SMALLDESC
  38.       ChangeUI IDD_SELCOM "${MUI_UI_COMPONENTSPAGE_SMALLDESC}"
  39.     !else ifdef MUI_COMPONENTSPAGE_NODESC
  40.       ChangeUI IDD_SELCOM "${MUI_UI_COMPONENTSPAGE_NODESC}"
  41.     !endif
  42.  
  43.     CheckBitmap "${MUI_COMPONENTSPAGE_CHECKBITMAP}"    
  44.        
  45.   !endif
  46.  
  47. !macroend
  48.  
  49.  
  50. ;--------------------------------
  51. ;Page declaration
  52.  
  53. !macro MUI_PAGEDECLARATION_COMPONENTS
  54.  
  55.   !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}COMPONENTSPAGE ""
  56.   !insertmacro MUI_COMPONENTSPAGE_INTERFACE
  57.  
  58.   !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_TEXT_TOP ""
  59.   !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_TEXT_COMPLIST ""
  60.   !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_TEXT_INSTTYPE ""
  61.   !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE "$(MUI_INNERTEXT_COMPONENTS_DESCRIPTION_TITLE)"
  62.   !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO "$(MUI_INNERTEXT_COMPONENTS_DESCRIPTION_INFO)"
  63.   
  64.   PageEx ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}components
  65.  
  66.     PageCallbacks ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsLeave_${MUI_UNIQUEID}
  67.  
  68.     Caption " "
  69.  
  70.     ComponentText "${MUI_COMPONENTSPAGE_TEXT_TOP}" "${MUI_COMPONENTSPAGE_TEXT_INSTTYPE}" "${MUI_COMPONENTSPAGE_TEXT_COMPLIST}"
  71.  
  72.   PageExEnd
  73.  
  74.   !insertmacro MUI_FUNCTION_COMPONENTSPAGE ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsLeave_${MUI_UNIQUEID}
  75.  
  76.   !undef MUI_COMPONENTSPAGE_TEXT_TOP
  77.   !undef MUI_COMPONENTSPAGE_TEXT_COMPLIST
  78.   !undef MUI_COMPONENTSPAGE_TEXT_INSTTYPE
  79.   !insertmacro MUI_UNSET MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE
  80.   !insertmacro MUI_UNSET MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO
  81.  
  82. !macroend
  83.  
  84. !macro MUI_PAGE_COMPONENTS
  85.  
  86.   !verbose push
  87.   !verbose ${MUI_VERBOSE}
  88.  
  89.   !insertmacro MUI_PAGE_INIT
  90.   !insertmacro MUI_PAGEDECLARATION_COMPONENTS
  91.  
  92.   !verbose pop
  93.  
  94. !macroend
  95.  
  96. !macro MUI_UNPAGE_COMPONENTS
  97.  
  98.   !verbose push
  99.   !verbose ${MUI_VERBOSE}
  100.  
  101.   !insertmacro MUI_UNPAGE_INIT
  102.   !insertmacro MUI_PAGEDECLARATION_COMPONENTS
  103.  
  104.   !verbose pop
  105.  
  106. !macroend
  107.  
  108.  
  109. ;--------------------------------
  110. ;Page functions
  111.  
  112. !macro MUI_FUNCTION_COMPONENTSPAGE PRE SHOW LEAVE
  113.  
  114.   Function "${PRE}"
  115.     !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE
  116.     !insertmacro MUI_HEADER_TEXT_PAGE $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_COMPONENTS_TITLE) $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_COMPONENTS_SUBTITLE)
  117.   FunctionEnd
  118.  
  119.   Function "${SHOW}"
  120.   
  121.     ;Get control hanldes
  122.     FindWindow $mui.ComponentsPage "#32770" "" $HWNDPARENT
  123.     GetDlgItem $mui.ComponentsPage.Text             $mui.ComponentsPage 1006
  124.     GetDlgItem $mui.ComponentsPage.InstTypesText    $mui.ComponentsPage 1021
  125.     GetDlgItem $mui.ComponentsPage.ComponentsText   $mui.ComponentsPage 1022
  126.     GetDlgItem $mui.ComponentsPage.InstTypes        $mui.ComponentsPage 1017
  127.     GetDlgItem $mui.ComponentsPage.Components       $mui.ComponentsPage 1032
  128.     GetDlgItem $mui.ComponentsPage.DescriptionTitle $mui.ComponentsPage 1042
  129.     GetDlgItem $mui.ComponentsPage.DescriptionText  $mui.ComponentsPage 1043
  130.     GetDlgItem $mui.ComponentsPage.SpaceRequired    $mui.ComponentsPage 1023    
  131.  
  132.     ;Default text in description textbox
  133.     SendMessage $mui.ComponentsPage.DescriptionTitle ${WM_SETTEXT} 0 "STR:${MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE}"
  134.     EnableWindow $mui.ComponentsPage.DescriptionText 0
  135.     SendMessage $mui.ComponentsPage.DescriptionText ${WM_SETTEXT} 0 "STR:${MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO}"
  136.  
  137.     StrCpy $mui.ComponentsPage.DescriptionText.Info "${MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO}" ;Text for current components page
  138.  
  139.     !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW
  140.  
  141.   FunctionEnd
  142.  
  143.   Function "${LEAVE}"
  144.  
  145.     !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE
  146.  
  147.   FunctionEnd
  148.  
  149. !macroend
  150.  
  151.  
  152. ;--------------------------------
  153. ;Script functions for components descriptions
  154.  
  155. !macro MUI_DESCRIPTION_BEGIN
  156.  
  157.   ${if} $0 == -1
  158.     ;No mouse hover over component in list
  159.     SendMessage $mui.ComponentsPage.DescriptionText ${WM_SETTEXT} 0 "STR:"
  160.     EnableWindow $mui.ComponentsPage.DescriptionText 0
  161.     SendMessage $mui.ComponentsPage.DescriptionText ${WM_SETTEXT} 0 "STR:$mui.ComponentsPage.DescriptionText.Info"
  162.  
  163. !macroend
  164.  
  165. !macro MUI_DESCRIPTION_TEXT VAR TEXT
  166.  
  167.   !verbose push
  168.   !verbose ${MUI_VERBOSE}
  169.  
  170.   ${elseif} $0 == ${VAR}
  171.     SendMessage $mui.ComponentsPage.DescriptionText ${WM_SETTEXT} 0 "STR:"
  172.     EnableWindow $mui.ComponentsPage.DescriptionText 1
  173.     SendMessage $mui.ComponentsPage.DescriptionText ${WM_SETTEXT} 0 "STR:${TEXT}"
  174.  
  175.   !verbose pop
  176.  
  177. !macroend
  178.  
  179. !macro MUI_DESCRIPTION_END
  180.  
  181.   !verbose push
  182.   !verbose ${MUI_VERBOSE}
  183.  
  184.   ${endif}
  185.  
  186.   !verbose pop
  187.  
  188. !macroend
  189.  
  190. !macro MUI_FUNCTION_DESCRIPTION_BEGIN
  191.  
  192.   !verbose push
  193.   !verbose ${MUI_VERBOSE}
  194.  
  195.   Function .onMouseOverSection
  196.     !insertmacro MUI_DESCRIPTION_BEGIN
  197.  
  198.   !verbose pop
  199.  
  200. !macroend
  201.  
  202. !macro MUI_FUNCTION_DESCRIPTION_END
  203.  
  204.   !verbose push
  205.   !verbose ${MUI_VERBOSE}
  206.  
  207.     !insertmacro MUI_DESCRIPTION_END
  208.     !ifdef MUI_CUSTOMFUNCTION_ONMOUSEOVERSECTION
  209.       Call "${MUI_CUSTOMFUNCTION_ONMOUSEOVERSECTION}"
  210.     !endif
  211.   FunctionEnd
  212.  
  213.   !verbose pop
  214.  
  215. !macroend
  216.  
  217. !macro MUI_UNFUNCTION_DESCRIPTION_BEGIN
  218.  
  219.   !verbose push
  220.   !verbose ${MUI_VERBOSE}
  221.  
  222.   Function un.onMouseOverSection
  223.     !insertmacro MUI_DESCRIPTION_BEGIN
  224.  
  225.   !verbose pop
  226.  
  227. !macroend
  228.  
  229. !macro MUI_UNFUNCTION_DESCRIPTION_END
  230.  
  231.   !verbose push
  232.   !verbose ${MUI_VERBOSE}
  233.  
  234.     !insertmacro MUI_DESCRIPTION_END
  235.     !ifdef MUI_CUSTOMFUNCTION_UNONMOUSEOVERSECTION
  236.       Call "${MUI_CUSTOMFUNCTION_UNONMOUSEOVERSECTION}"
  237.     !endif
  238.   FunctionEnd
  239.  
  240.   !verbose pop
  241.  
  242. !macroend
  243.